package 内存可见性复习;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-10-06
 * Time: 18:11
 */
 class Count0{
     public int count = 0;
}
public class demo2 {

    public static void main(String[] args) {
        Count0 count = new Count0();
        Thread t = new Thread() {
            @Override
            public void run() {
                while (count.count == 0) {

                }
                System.out.println("t线程结束");
            }
        };
        t.start();
        Thread t1 = new Thread(){
            @Override
            public void run() {
            count.count = 1;
            }
        };
        t1.start();
    }

}

